///*
// * To change this template, choose Tools | Templates
// * and open the template in the editor.
// */
//package test.classTest;
//
//import com.mp.appApi.database.HibernateUtils;
//import com.mp.appApi.util.XmlUtils;
//import java.io.File;
//import java.net.URL;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Random;
//import org.dom4j.Document;
//import org.dom4j.DocumentException;
//import org.hibernate.Criteria;
//import org.hibernate.Session;
//import org.hibernate.SessionFactory;
//import org.hibernate.cfg.Configuration;
//import org.jasypt.util.text.BasicTextEncryptor;
//import test.data.Doctor;
//
///**
// *
// * @author vannh
// */
//
//public class protect {
//    static final String SALT = "3P@q2b4h0@xlgBKA4$wEMti0GL&0BRf#e5C";
//    
//    public static void main(String[] args) throws DocumentException, Exception{
//        HibernateUtils HUtil = HibernateUtils.getInstance();
//        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
//        URL url = classLoader.getResource("test.xml");
//        System.out.println(url.getPath());
//        HUtil.buildPool(url.getPath(), SALT);
//        
//        List<Thread> ths = new ArrayList<Thread>();
//        
//        for(int i = 0; i < 10000; i++){
//            Thread t = new Thread(new Runnable() {
//
//                @Override
//                public void run() {
//                    Random ran = new Random(System.currentTimeMillis());
//                    int k = ran.nextInt(3);
//                    String name = k == 1 ? "default session" : (k == 2) ? "CR" : "  gate";
//                    try {
////                        System.out.println(name);
//                        HibernateUtils HUtil = HibernateUtils.getInstance();
//                        Session se = HUtil.getCurrentSession(name);
//                        Criteria cri = se.createCriteria(Doctor.class);
//                        List ls = cri.list();
//                        se.close();
////                        System.out.println(Thread.currentThread().getId() + ",  ls: " + ls.size());
//                    } catch (Exception e) {
//                        System.out.println(e);
//                    }
//                }
//            });
//            
//            ths.add(t);
//        }
//        
//        for(Thread t : ths){
//            t.start();
//        }
//        
//        System.out.println("ok");
//    }
//}
